#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int N, W;
constexpr int MAXV = 101, MAXN = 100, INF = 1 << 30;
void solve();
vector<pair<int, int>> Products; // first表示质量, second表示价值
int main() {
    cin >> N;
    for (int i = 0; i < N; i++) {
        int w, v;
        cin >> w >> v;
        Products.emplace_back(w, v);
    }
    cin >> W;
    solve();
}

int dp[MAXN + 1][MAXV * MAXN];
// 探索, 从前i个挑选价值为j的最小质量
void solve() {
    dp[0][0] = 0;
    for (int i = 1; i < N; i++) dp[0][i] = INF;
    for (int i = 0; i < N; i++) {
        for (int j = 0; j < N * MAXV; j++) {
            if (j < Products[i].second) {
                dp[i + 1][j] = dp[i][j];
            } else {
                dp[i + 1][j] = min(dp[i][j], dp[i][j - Products[i].second] + Products[i].first);
            }
        }
    }
    int res = 0;
    for (int i = 0; i <= MAXN * MAXV; i++) if (dp[N][i] <= W) res = i;
    cout << res << endl;
}